<template>
<div>
</div>
</template>

<script>

import { scanQrCode } from '../../api/user'

export default {
  name: 'index',
  data () {
    return {

    }
  },
  methods: {
    init () {
      let data = {
        uuid: this.$route.query.uuid
      }
      scanQrCode(data).then(ret => {
        if (ret.data.errcode === 0) {
          let x = ret.data.data
          let url = 'https://open.weixin.qq.com/connect/oauth2/authorize?' +
            'appid=' + x.appid + '&redirect_uri=' + x.redirect_uri + '&response_type=code&scope=snsapi_userinfo&state=' + x.state + '#wechat_redirect'
          // console.log(x)
          window.location.href = url
        } else {
          this.$Message.error(ret.data.errmsg)
        }
      })
    }
  },
  mounted () {
    this.init()
  }
}
</script>

<style scoped>

</style>
